package com.mmall.pay.enums;

/**
 * @author gg
 * @version FlowStateENum.java, v 0.1 2019-05-27 19:56 gg
 */
public enum FlowStateEnum {

    NOT_AUDIT(1, "未审核"),
    AUDIT(2, "已审核"),
    ;

    private String desc;
    private Integer code;

    FlowStateEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Getter method for property <tt>value</tt>.
     *
     * @return property value of value
     */
    public Integer getCode() {
        return code;
    }

    public static FlowStateEnum getByValue(Integer value) {
        FlowStateEnum[] valueList = FlowStateEnum.values();
        for (FlowStateEnum v : valueList) {
            if (v.getCode().equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static String getName(Integer value) {
        FlowStateEnum[] valueList = FlowStateEnum.values();
        for (FlowStateEnum v : valueList) {
            if (v.getCode().equals(value)) {
                return v.getDesc();
            }
        }
        return null;
    }
}